/*
 * IsoBitmap - bitmap aligned to an isometric coordinate system
 *
 * Copyright 2007 James W. Hofmann
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#if flash9
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Point;
#end

class IsoBitmap extends Bitmap
// IsoBitmap - contains px/py/pz, the object center
{
	public var px : Float;
	public var py : Float;
	public var pz : Float;
	public var sortsum : Int;
	
	// offx, offy are currently mapped to center the object around p(x/y/z)
	public var offx : Float;
	public var offy : Float;
	
	public function movep(newmove : Point)
	{
		px = newmove.x;
		py = newmove.y;
		sortsum = Std.int(py * 16 + px % 16);
		x = px+offx;
		y = py+offy;
	}

	public function moveup()
	{
		sortsum = Std.int(py * 16 + px % 16);
		x = px+offx;
		y = py+offy;
	}
	
	public function new(bd : BitmapData)
	{
		super();
		this.bitmapData = bd;
		this.offx = - (bd.width)/2;
		this.offy = - (bd.height)/2;
		this.px = 0;
		this.py = 0;
		sortsum = 0;
	}

}
